<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>AngularJS&middot;Hello AngularJS</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.css">
    <style>
        .demo{
            margin-bottom:10px;
            border-bottom:1px solid #1b926c;
        }
        /*.navbar{*/
            /*border:1px solid #1b926c;*/
            /*background-color: #1fa67a;*/
        /*}*/

    </style>
</head>
<body>

 <div class="container">
     <div class="row">
         <nav class="navbar navbar-default navbar-static-top">
             <div class="container-fluid">
                 <div class="navbar-header">
                     <a class="navbar-brand" href="../index.html">首页</a>
                 </div>
                 <ul class="nav navbar-nav">
                    <li class="active"><a href="javascript:void(0)">Link</a></li>
                    <li><a href="javascript:void(0)">Link2</a></li>
                 </ul>
             </div>
         </nav>
     </div>
     <div ng-app="myApp">
         <div class="row demo">
             <h3>Demo1:继承关系示例</h3>
             <div ng-controller="ParentController">
                 <div ng-controller="ChildController">
                     <h5>输出：country-> {{person.country}}</h5>
                     <a href="javascript:void(0)" ng-click="sayHello()" class="btn btn-success">Show Person Info</a>
                     <h5 style="font-weight: bolder;">{{person.name}},  {{person.address}},  {{person.gender}},  {{person.age}}</h5>
                 </div>
             </div>

         </div>
     </div>
 </div>
</body>
</html>
<script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.js" type="text/javascript"></script>
<script>
    var myApp=angular.module("myApp",[]);
    myApp.controller("ParentController",function($scope){
        $scope.person={
            country:"Asia"
        }
    });
    myApp.controller("ChildController",function($scope){
       $scope.sayHello=function(){
         $scope.person.name="shikezhi";
         $scope.person.address="http://www.shikezhi.com";
         $scope.person.gender="Male";
         $scope.person.age=20;
       }
    });
</script>
